<?php
if (isset($_FILES['icon_photo']) &&isset($_FILES['icon_photo']["tmp_name"])
    && file_exists($_FILES['icon_photo']["tmp_name"]))
  {
    $rel_addr = "tmp/".$_FILES['icon_photo']["name"];
    $new = dirname(__FILE__)."/".$rel_addr;
    if (file_exists($new))
      unlink($new);
    rename($_FILES['icon_photo']["tmp_name"], $new);
    die(json_encode(array("user_id"=>1, "pic"=>$rel_addr)));
  }
else
  {
    die("not find upload file!");
  }
























